﻿<Page x:Class="MyCalManager.View.UserView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:Helper="clr-namespace:MyCalManager.Helper"
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="360"
	  Title="UserView"
      DataContext="{Binding UserView, Source={StaticResource Locator}}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Skins/MainSkin.xaml" />
                <ResourceDictionary Source="/Skins/Theme.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" MinHeight="100"/>
            <RowDefinition Height="Auto" MinHeight="20" />
            <RowDefinition Height="Auto" MinHeight="20" />
        </Grid.RowDefinitions>
        
        <ListView HorizontalAlignment="Left" VerticalAlignment="Top" 
                  SelectedItem="{Binding selectedUser}" 
                  ItemsSource="{Binding Users}" 
                  Margin="10,10,10,2" Width="315" Height="150" SelectionMode="Single">
            
            <ListView.View>
                <GridView AllowsColumnReorder="False">
                    <GridViewColumn Header="{Loc UserMsg_Name}"  Width="150" DisplayMemberBinding="{Binding Name}"></GridViewColumn>
                    <GridViewColumn Header="{Loc UserMsg_Vorname}"  Width="150" DisplayMemberBinding="{Binding Vorname}"></GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>
        <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="10,0,10,10">
            <Helper:InfoTextBox Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsValid="{Binding NameValid, Mode=TwoWay}" Visibility="{Binding visibility,Converter={Helper:BooleanToVisibilityConverter}}" Width="150" Height="25" InputType="TextNotNull" TextBoxInfo="{Loc LastNameTxtBox}"></Helper:InfoTextBox>
            <Helper:InfoTextBox Text="{Binding VorName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsValid="{Binding VorNameValid, Mode=TwoWay}" Visibility="{Binding visibility,Converter={Helper:BooleanToVisibilityConverter}}" Width="150" Height="25" InputType="TextNotNull" TextBoxInfo="{Loc FirstNameTxtBox}"></Helper:InfoTextBox>
            <Button ToolTipService.ShowOnDisabled="True"  Command="{Binding AddUser}" Visibility="{Binding visibility,Converter={Helper:BooleanToVisibilityConverter}}" Margin="5" ToolTip="{Loc SmallAddUserBtn}" Width="25" Height="25">
                <Button.Content>
                    <Image Style="{StaticResource toolbarImageStyle}" Source="pack://application:,,,/Images/user_add.png"></Image>
                </Button.Content>
            </Button>
        </StackPanel>
        <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="10,0,10,10">
            <CheckBox Name="defaultUser" IsChecked="{Binding defaultUser}" Margin="5" Content="{Loc defaultUser}"></CheckBox>
            <Button ToolTipService.ShowOnDisabled="True" Command="{Binding DelUser}" Visibility="{Binding visibility,Converter={Helper:BooleanToVisibilityConverter}}" Margin="96,0,0,0" ToolTip="{Loc SmallDellUserBtn}" Width="25" Height="25">
                <Button.Content>
                    <Image Style="{StaticResource toolbarImageStyle}" Source="pack://application:,,,/Images/user_delete.png"></Image>
                </Button.Content>
            </Button>
            <Button Command="{Binding Cancel}" Visibility="{Binding visibility,Converter={Helper:BooleanToVisibilityConverter}}" Margin="10,0,0,0" ToolTip="{Loc SmallCancelBtn}" Width="25" Height="25">
                <Button.Content>
                    <Image Source="pack://application:,,,/Images/Remove Mark.png"></Image>
                </Button.Content>
            </Button>
            <Button Command="{Binding Ok}" Visibility="{Binding visibility,Converter={Helper:BooleanToVisibilityConverter}}" Margin="10,0,0,0" ToolTip="Ok" Width="25" Height="25">
                <Button.Content>
                    <Image Source="pack://application:,,,/Images/Check Mark.png"></Image>
                </Button.Content>
            </Button>
        </StackPanel>
    </Grid>
</Page>
